﻿#region Copyright

//  ======================================================
//      Copyright (c) 2011 Toulr All rights reserved.
//     
//      The use and distribution terms for this software are contained in the file
//      named license.txt, which can be found in the root of this distribution.
//      By using this software in any fashion, you are agreeing to be bound by the
//      terms of this license.
//     
//     You must not remove this notice, or any other, from this software.
//  ======================================================

#endregion

#region Using Namespaces

using System.Data.Entity;
using Toulr.Domains.Account;
using Toulr.Domains.Business;
using Toulr.Domains.System;

#endregion

namespace Toulr.Domains
{
    public class DomainContext : DbContext
    {
        public DomainContext()
            : base(Application.ConnectionConfigName)
        {
            Configuration.LazyLoadingEnabled = true;
#if DEBUG
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<DomainContext>());
#endif
        }

        /// <summary>
        ///   Gets the instance.
        /// </summary>
        /// Author: James Cheung
        /// MachineName: JAMESCHEUNG-PC
        /// DateTime: 2011/5/10 14:24
        public static DomainContext Instance
        {
            get
            {
                return new DomainContext();
            }
        }

        //地理位置相关对象
        public DbSet<City> Cities { get; set; }
        public DbSet<Province> Provinces { get; set; }
        public DbSet<Counties> Counties { get; set; }
        public DbSet<ShoppingArea> ShoppingAreas { get; set; }

        //用户帐号相关对象
        public DbSet<User> Users { get; set; }
        public DbSet<UserRole> UserRoles { get; set; }
        public DbSet<Permission> Permissions { get; set; }
        public DbSet<RolePermissions> RolePermissions { get; set; }
        public DbSet<Friends> Friends { get; set; }
        public DbSet<FriendStatus> FriendStatus { get; set; }
        public DbSet<Messages> Messageses { get; set; }
        public DbSet<UserAccount> UserAccounts { get; set; }
        public DbSet<UserAddress> UserAddresses { get; set; }
        public DbSet<UserEvaluation> UserEvaluations { get; set; }
        public DbSet<UserHobby> UserHobbies { get; set; }
        public DbSet<UserNoticeConfig> UserNoticeConfigs { get; set; }


        //商铺、商品相关
        public DbSet<Bill> Bills { get; set; }
        public DbSet<ExpressDelivery> ExpressDeliveries { get; set; }
        public DbSet<Goods> Goodses { get; set; }
        public DbSet<GoodsEvaluation> GoodsEvaluations { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<OrderStatus> OrderStatus { get; set; }
        public DbSet<Promotions> Promotionses { get; set; }
        public DbSet<Shop> Shops { get; set; }
        public DbSet<ShopManagerHistory> ShopManagerHistories { get; set; }
        public DbSet<ShopEvaluation> ShopEvaluations { get; set; }
        public DbSet<ShopProperty> ShopPropertys { get;set; }
        public DbSet<ShopEvaluationDetail> ShopEvaluationDetails { get; set; }

        //其他
        public DbSet<Albums> Albumses { get; set; }
        public DbSet<Banks> Bankses { get; set; }
        public DbSet<InfoCategories> InfoCategorieses { get; set; }
        public DbSet<InfoCategoriesProperty> InfoCategoriesPropertys { get; set; }
        public DbSet<Photos> Photoses { get; set; }
        public DbSet<Recommended> Recommendeds { get; set; }
        public DbSet<SystemDictionary> SystemDictionaries { get; set; }
        public DbSet<SystemLog> SystemLogs { get; set; }
        public DbSet<UserLoginHistory> UserLoginHistories { get; set; }
        public DbSet<EvaluationReply> EvaluationReplys { get; set; }
    }
}